<%#
    Auth: Wen
    Version: V1.0
    Data: 2019.8.20
    Function:
%>
<%+header%>
<html>
    <head>
    <meta charset="utf-8">
    <title>Wen</title>
    <script type="text/javascript">
    var XHR1 = new XHR();

    function GetSubReflectorInfo()
    {
        XHR1.post('<%=controller%>admin/ACU_Antenna/getSub', {token:'<%=token%>', step: '1'}, function(x){
			
            //对返回的数据进行解析，并填入到相应的控件
            var str = x.responseText;
            //是否有错误警告
            if(str.match(/Error/g) == null)
            {
                var n = str.split(",");
                if(n[2] == '0')
                {
                    document.getElementById("subReflectorTrack").innerHTML = "<%:OFF%>";
                }
                else if(n[2] == '1')
                {
                    document.getElementById("subReflectorTrack").innerHTML = "<%:ON%>";
                }
                document.getElementById("agcEnlarge").innerHTML = n[3];
                document.getElementById("setEnlarge").value = n[3]
                document.getElementById("phaseOffset").innerHTML = n[4];
                document.getElementById("setPhaseOffset").value = n[4];
                document.getElementById("phaseDigits").innerHTML = n[5];   
                var y = n[5].split("*");
                document.getElementById("phaseDigits").innerHTML = y[0];
                document.getElementById("setPhaseDigits").value = y[0];
                document.getElementById("warmingGetSub").innerHTML = "";
				document.getElementById("warmingGetSub").innerHTML = "Data:" + n[2] + "," + n[3] + "," + n[4] + "," + y[0];
            }
            else
            {
                document.getElementById("warmingGetSub").innerHTML = "Title:" + x.responseText;
            }
        })
    }

    function SetSubReflector()
    {
		document.getElementById("warmingSetSub").innerHTML = "";
        if(document.getElementById("subReflectorTrack").value == 0 &&
            document.getElementById("agcEnlarge").value == 0)
        {
            document.getElementById("warmingSetSub").innerHTML = "<%:Title: Please get sub reflector info at first!%>";
        }
        else
        {
            var subData = new Object();
            subData.setTrack = document.getElementById("setTrack").value;
            subData.setEnlarge = document.getElementById("setEnlarge").value;
            subData.setPhaseOffset = document.getElementById("setPhaseOffset").value;
            subData.setPhaseDigits = document.getElementById("setPhaseDigits").value;
            
            //将WEB上输入的天线校准数据传送到后台
            XHR1.post('<%=controller%>admin/ACU_Antenna/setSub', {token:'<%=token%>', 
                para1: subData.setTrack ,
                para2: subData.setEnlarge,
                para3: subData.setPhaseOffset,
                para4: subData.setPhaseDigits}, function(x){
                //如果设置失败怎弹出告警框
                if(x.responseText == "$GCCMD,COMMAND OK*01\r\n")
                {
                    document.getElementById("warmingSetSub").innerHTML = "<%:Title: Set sub success!%>";
					GetSubReflectorInfo();
                }
                else
                {
                    document.getElementById("warmingSetSub").innerHTML = "Title:" + x.responseText;
                }
            })
            document.getElementById("warmingGetSub").innerHTML = "";
        }
    }



    </script>
    </head>
    <body>
        <p style="color:red;" id="warmingGetSub"></p>
        <fieldset class="cbi-section">
        <div class="widget-box">
            <div class="widget-title">
                <span class="icon">
                <i class="icon-align-justify"></i>
                </span>
                <h5><%:Sub Reflector Info%></h5>
            </div>
            <div class="widget-content nopadding">
                <table width="100%" cellspacing="10">
                    <tr><td width="33%"><%:Sub Reflector Track%></td><td id="subReflectorTrack"></td></tr>
                    <tr><td width="33%"><%:AGC Enlarge%></td><td id="agcEnlarge"></td></tr>
                    <tr><td width="33%"><%:Phase Offset%></td><td id="phaseOffset"></td></tr>
                    <tr><td width="33%"><%:Phase Digits%></td><td id="phaseDigits"></td></tr>											
                </table>
                <script>
                    GetSubReflectorInfo();
                </script>
            </div>
        </div>
        </fieldset>
        
        <p style="color:red;" id="warmingSetSub"></p>
        <fieldset class="cbi-section">
        <div class="widget-box">
            <div class="widget-title">
                <span class="icon">
                <i class="icon-align-justify"></i>
                </span>
                <h5><%:Set Sub Reflector%></h5>
                <div class="pull-right">
                    <div style="margin-top: 4px; margin-bottom: 0px;margin-right:10px">
                    <input class="btn btn-success" type="button" value="<%:Set Sub Reflector%>" onclick="SetSubReflector()">
                    <i class="icon"></i>
                    </div>
                    </div>
            </div>
            <div class="widget-content nopadding">
                <table width="100%" cellspacing="10">
                    <tr><td width="15%"><%:Set Sub Reflector Track%></td><td>
                        <select class="cbi-input-select" data-update="change" id="setTrack" size="1">
                        <option value="0" selected="selected"><%:OFF%></option>
                        <option value="1"><%:ON%></option>
                        </select>
                    </td></tr>
                    <tr><td width="15%"><%:Set AGC Enlarge%></td><td><input id="setEnlarge" type="number" min="0" max="255" class="cbi-input-text"/>
                        <div class="cbi-value-description">
                            <span class="cbi-value-helpicon">
                                <img src="/luci-static/resources/cbi/help.gif" alt="help" />
                            </span>
                            <%:Range%>:0~255
                        </div>
                    </td></tr>
                    <tr><td width="15%"><%:Set Phase Offset%></td><td><input id="setPhaseOffset" type="number" disabled="disabled" class="cbi-input-text"/>
                        <div class="cbi-value-description">
                            <span class="cbi-value-helpicon">
                                <img src="/luci-static/resources/cbi/help.gif" alt="help" />
                            </span>
                        </div>
                    </td></tr>
                    <tr><td width="15%"><%:Set Phase Digits%></td><td><input id="setPhaseDigits" type="number" disabled="disabled" class="cbi-input-text"/>
                        <div class="cbi-value-description">
                            <span class="cbi-value-helpicon">
                                <img src="/luci-static/resources/cbi/help.gif" alt="help" />
                            </span>
                        </div>
                    </td></tr>
                </table>
            </div>
        </div>
        </fieldset>	
    </body>
</html>
<%+footer%>